package vehement.game.graphics.primitive;

import org.lwjgl.opengl.GL11;

import vehement.game.interfaces.Drawable;

/**
 * Billboards are textures that always face the camera
 */
public class GLBillboard implements Drawable{
	float height = 1.f;
	float width = 1.f;
	//private Sprite message;

	
	//TODO: FIX THIS
	/*
	public void draw()
	{
	  //gl
	  // avoid problem with overlapping alpha blends
	  gl.glDepthMask(false);
	       // protect the depth buffer by making it read-only
	  gl.glEnable(GL11.GL_BLEND);   // enable color and texture blending
	  gl.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	  gl.glEnable(GL11.GL_TEXTURE_2D);
	  gl.glEnable(GL11.GL_COLOR_MATERIAL);
	  gl.glEnable(GL11.GL_POINT_SPRITE_OES);  // use point sprites
	  // generate point sprite texture coords
	  gl.glTexEnvx(GL11.GL_POINT_SPRITE_OES,
	                  GL11.GL_COORD_REPLACE_OES, GL11.GL_TRUE);
//	  setTexture();
	  // enable the buffers for rendering
	  gl.glEnableClientState(GL11.GL_VERTEX_ARRAY);
	  gl.glEnableClientState(GL11.GL_COLOR_ARRAY);
	  gl.glEnableClientState(GL11.GL_POINT_SIZE_ARRAY_OES);
	  // load the buffers
//	  gl.glVertexPointer(3, GL11.GL_FLOAT, 0, posnsBuf);
//	  gl.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 0, colsBuf);
//	  gl.glPointSizePointerOES(GL11.GL_FLOAT, 0, sizesBuf);
//	  gl.glDrawArrays(GL11.GL_POINTS, 0, NUM_PARTS);  // draw points
	  // disable the buffers at the end of rendering
	  gl.glDisableClientState(GL11.GL_VERTEX_ARRAY);
	  gl.glDisableClientState(GL11.GL_COLOR_ARRAY);
	  gl.glDisableClientState(GL11.GL_POINT_SIZE_ARRAY_OES);
	  // switch off point sprites
	  gl.glTexEnvx(GL11.GL_POINT_SPRITE_OES,
	              GL11.GL_COORD_REPLACE_OES, GL11.GL_FALSE);
	  gl.glDisable(GL11.GL_POINT_SPRITE_OES);
	  // restore other states
	  gl.glDisable(GL11.GL_COLOR_MATERIAL);
	  gl.glDisable(GL11.GL_TEXTURE_2D);
	  gl.glDisable(GL11.GL_BLEND);
	  gl.glDepthMask(true);
	  
	}  // end of draw()
*/
	
	/**
	 * This should be handled by sprite
	 */
	public void draw() {
		// store the current model matrix
		/*
		GL11.glPushMatrix();
		
		// enable textures since we're going to use these for our sprites
		GL11.glEnable(GL11.GL_TEXTURE_2D);	
		// bind to the appropriate texture for this sprite
		texture.bind();
	    
		// translate to the right location and prepare to draw
//		GL11.glTranslatef(x, y, 0);		
    	GL11.glColor3f(1,1,1);
			
		// draw a quad textured to match the sprite
    	GL11.glBegin(GL11.GL_QUADS);
		{
		      GL11.glTexCoord2f(0, 0);
		      GL11.glVertex2f(0, 0);
		      GL11.glTexCoord2f(0, texture.getHeight());
		      GL11.glVertex2f(0, height);
		      GL11.glTexCoord2f(texture.getWidth(), texture.getHeight());
		      GL11.glVertex2f(width,height);
		      GL11.glTexCoord2f(texture.getWidth(), 0);
		      GL11.glVertex2f(width,0);
		}
		GL11.glEnd();
			
		// restore the model view matrix to prevent contamination
		GL11.glPopMatrix();
		*/
	}


}
